Skip to content

fix: return errors instead of UB in boolean evaluators - #413

Open
alexskinner wants to merge 1 commit into
KipData:mainfrom
alexskinner:upstream/fix-evaluator-ub
Open

alexskinner wants to merge 1 commit into
KipData:mainfrom
alexskinner:upstream/fix-evaluator-ub

Conversation

@alexskinner

Copy link
Copy Markdown
Collaborator

boolean_not_unary_eval and the boolean binary evaluators used unreachable_unchecked on unexpected value types. Fuzzing can reach those arms when binder type checks are incomplete, so return UnsupportedUnaryOperator or Incomparable instead.

Includes a unit test and an SLT regression (tests/slt/boolean_type_safety.slt).

boolean_not_unary_eval and the boolean binary evaluators used
unreachable_unchecked on unexpected value types. Fuzzing can reach those
arms when binder type checks are incomplete, so return UnsupportedUnaryOperator
or Incomparable instead. Cover the NOT mismatch with a unit test and an SLT
regression.

Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 30.43478% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.05%. Comparing base (34a2123) to head (7042170).

Files with missing lines Patch % Lines
src/types/evaluator/boolean.rs 27.27% 16 Missing ⚠️

❌ Your patch check has failed because the patch coverage (30.43%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #413      +/-   ##
==========================================
- Coverage   93.08%   93.05%   -0.03%     
==========================================
  Files         282      282              
  Lines       39885    39900      +15     
==========================================
+ Hits        37125    37129       +4     
- Misses       2760     2771      +11     
Flag Coverage Δ
rust 93.05% <30.43%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/types/evaluator/unary.rs 97.56% <100.00%> (ø)
src/types/evaluator/boolean.rs 72.88% <27.27%> (-15.76%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KKould

KKould commented Nov 27, 2026

Copy link
Copy Markdown
Member

This behavior is, in fact, intentional; boolean_not_unary_eval is forwarded to this logic by UnaryEvaluatorRef. This design was implemented to mitigate the performance impact on runtime computation that would otherwise arise from an excessive number of branches related to value types.

The accuracy of this calculation is guaranteed by BindEvaluator.

Are you trying to resolve this issue because it’s causing a bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants